#ifndef KC_ARCHIVE_H__KC
#define KC_ARCHIVE_H__KC

#include <iostream>
#include "MySQLConnector.h"
#include "../mime/data/Message.h"
#include "../filter/Rule.h"

namespace kc_sf
{
	class Archive
	{
		public:
			
			explicit Archive( const Message &msg, ActionType action );

			void operator()();

		private:

			Message a_message;
			MySQLConnector a_conn;
			ActionType a_action;

			size_t insertHeader( size_t msg_id, const Header &header );
			size_t insertAttachment( size_t msg_id, const Attachment &attch );
			void insertMessageRecipients( size_t msg_id );
			void insertMessageTo( size_t msg_id );
			void insertMessageCc( size_t msg_id );
			void insertMessageBcc( size_t msg_id );
			size_t insertEmailAddress( const Address &e_mail );
	};
}

#endif /* KC_ARCHIVE_H__KC */
